package com.sugou.dao.support.ext.beans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.sugou.dao.support.ParamsStatement;
import com.sugou.dao.support.Statement;
import com.sugou.dao.support.ext.Targets;

public class TargetsImpl implements Targets {
	private static final long serialVersionUID = -8394258870567670964L;
	
	private Statement body;
	
	private String alias;
	
	public TargetsImpl(Statement body,String alias) {
		this.body=body;
		this.alias=alias;
	}

	public List<? extends Serializable> getParams() {
		if(body instanceof ParamsStatement){
			return new ArrayList<Serializable>(((ParamsStatement) body).getParams());
		}
		return new ArrayList<Serializable>(0);
	}

	public String getContent() {
		return body.getContent()+" as "+this.alias;
	}

	public Statement getBody() {
		return this.body;
	}

	public String getAlias() {
		return this.alias;
	}

}
